/**
 * @filename:UserSimulateServiceImpl 2023-4-27
 * @project Wonder Java前后台分离框架  1.1.0
 * Copyright(c) 2022 Wonder Co. Ltd. 
 * All right reserved. 
 */
package com.wonder.app.service.impl;

import com.wonder.app.domain.UserSimulate;
import com.wonder.app.vo.UserSimulateVo;
import com.wonder.app.mapper.UserSimulateDao;
import com.wonder.app.service.UserSimulateService;
import com.wonder.app.request.UserSimulateRequest;
import com.wonder.common.utils.StringUtils;
import com.wonder.common.utils.MessageUtils;
import com.wonder.common.common.AjaxResult;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**   
 * @Description:TODO(模拟用户管理服务实现)
 *
 * @version: 1.1.0
 * @author: Wonder
 * 
 */
@Service
public class UserSimulateServiceImpl  extends ServiceImpl<UserSimulateDao, UserSimulate> implements UserSimulateService  {

    /**
     * 验证模拟用户管理信息
     * 
     * @param userSimulate
     * @param type
     * @return String
     */
    @Override
    public String validate(UserSimulate userSimulate,String type){
    
    
       return "";
    }
    
    
    /*
	 * 分页返回，自定义多表分页数据返回
	 */
	@Override 
    public IPage<UserSimulateVo> selectUserSimulateVoList(UserSimulateRequest request, Page<UserSimulateVo> page){
	    QueryWrapper<UserSimulateVo> queryWrapper = new QueryWrapper<>();
	    
	    if (null != request.getId()) {
	       queryWrapper.eq("a.id", request.getId());
	      }               
             
        
		queryWrapper.orderByDesc("a.id");	
		IPage<UserSimulateVo> selectPage = this.baseMapper.getUserSimulateVoList(page, queryWrapper);
		return selectPage;
    }
    
    /**
	 * 返回VO单个数据
	 */
	@Override 
	public UserSimulateVo getVoById(Long id){
	    QueryWrapper<UserSimulateVo> queryWrapper=new QueryWrapper<UserSimulateVo>().eq("a.id", id);
		return this.baseMapper.getUserSimulateVoList(queryWrapper);
	}
	
    /**
	 * Description:模拟用户管理分页返回
	 * @param request //检索条件
	 * @param page //分页参数
	 * @return IPage<UserSimulate>   //分页记录
	 */
	@Override 
	public IPage<UserSimulate> selectList(UserSimulateRequest request, Page<UserSimulate> page){
	    LambdaQueryWrapper<UserSimulate> lambdaQueryWrapper = new LambdaQueryWrapper<>();
	    
	    if (null != request.getId()) {
	       lambdaQueryWrapper.eq(UserSimulate::getId, request.getId());
	      }               
             
        
		lambdaQueryWrapper.orderByDesc(UserSimulate::getId);	
		Page<UserSimulate> selectPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);
		return selectPage;
    }
        
    
	
}